package com.yunshangwoniu.core.Assert;

import java.util.Collection;
import java.util.Map;

import com.yunshangwoniu.core.exception.UserCommonException;

public class UserCommonAssert
{
	public static void notNull(Object obj,String msg)
	{
		if(obj==null)
		{
			throw new UserCommonException(msg);
		}
	}
	
	
	public static void notEmpty(Object obj,String msg)
	{
		if(obj==null)
		{
			throw new UserCommonException(msg);
		}else if(obj instanceof Collection<?>)
		{
			if(((Collection<?>)obj).size()==0)
			{
				throw new UserCommonException(msg);
			}
		}else if(obj instanceof Map<?,?>)
		{
			if(((Map<?,?>)obj).size()==0)
			{
				throw new UserCommonException(msg);
			}
		}
			
	}
}

